package com.tudouji.project.harvest.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.tudouji.framework.aspectj.lang.annotation.Log;
import com.tudouji.framework.aspectj.lang.enums.BusinessType;
import com.tudouji.project.harvest.domain.WeightDeniedData;
import com.tudouji.project.harvest.service.IWeightDeniedDataService;
import com.tudouji.framework.web.controller.BaseController;
import com.tudouji.framework.web.domain.AjaxResult;
import com.tudouji.common.utils.poi.ExcelUtil;
import com.tudouji.framework.web.page.TableDataInfo;

/**
 * 过磅系统未采纳数据Controller
 * 
 * @author tudouji
 * @date 2022-03-28
 */
@RestController
@RequestMapping("/harvest/systemDeniedData")
public class WeightDeniedDataController extends BaseController
{
    @Autowired
    private IWeightDeniedDataService weightDeniedDataService;

    /**
     * 查询过磅系统未采纳数据列表
     */
    @PreAuthorize("@ss.hasPermi('harvest:systemDeniedData:list')")
    @GetMapping("/list")
    public TableDataInfo list(WeightDeniedData weightDeniedData)
    {
        startPage();
        List<WeightDeniedData> list = weightDeniedDataService.selectWeightDeniedDataList(weightDeniedData);
        return getDataTable(list);
    }

    /**
     * 导出过磅系统未采纳数据列表
     */
    @PreAuthorize("@ss.hasPermi('harvest:systemDeniedData:export')")
    @Log(title = "过磅系统未采纳数据", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(WeightDeniedData weightDeniedData)
    {
        List<WeightDeniedData> list = weightDeniedDataService.selectWeightDeniedDataList(weightDeniedData);
        ExcelUtil<WeightDeniedData> util = new ExcelUtil<WeightDeniedData>(WeightDeniedData.class);
        return util.exportExcel(list, "systemDeniedData");
    }

    /**
     * 获取过磅系统未采纳数据详细信息
     */
    @PreAuthorize("@ss.hasPermi('harvest:systemDeniedData:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(weightDeniedDataService.selectWeightDeniedDataById(id));
    }

    /**
     * 新增过磅系统未采纳数据
     */
    @PreAuthorize("@ss.hasPermi('harvest:systemDeniedData:add')")
    @Log(title = "过磅系统未采纳数据", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody WeightDeniedData weightDeniedData)
    {
        return toAjax(weightDeniedDataService.insertWeightDeniedData(weightDeniedData));
    }

    /**
     * 修改过磅系统未采纳数据
     */
    @PreAuthorize("@ss.hasPermi('harvest:systemDeniedData:edit')")
    @Log(title = "过磅系统未采纳数据", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody WeightDeniedData weightDeniedData)
    {
        return toAjax(weightDeniedDataService.updateWeightDeniedData(weightDeniedData));
    }

    /**
     * 删除过磅系统未采纳数据
     */
    @PreAuthorize("@ss.hasPermi('harvest:systemDeniedData:remove')")
    @Log(title = "过磅系统未采纳数据", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(weightDeniedDataService.deleteWeightDeniedDataByIds(ids));
    }
}
